#pragma once
constexpr auto PI = 3.14159265358979;

void binomial_mult(int n, double* p, double* a);
void trinomial_mult(int n, double* b, double* c, double* res);

void calculateACoefficients_bp_bs(int filterPassType, int n, double f1f, double f2f, double* dcof);
void calculateACoefficients_lp_hp(int n, double fcf, double* dcof);
void calculateACoefficients(int filterPassType, int filterOrder, double fcf1, double fcf2, double* a);

void calculateBCoefficients_bp(int n, double* ccof);
void calculateBCoefficients_lp(int n, double* ccof);
void calculateBCoefficients_hp(int n, double* ccof);
void calculateBCoefficients(int filterPassType, int filterOrder, double fcf1, double fcf2, double* a2);
double calculateScalingFactor_bp_bs(int filterPassType, int n, double f1f, double f2f);
double calculateScalingFactor_lp_hp(int filterPassType, int n, double fcf);
void  multiply(double* a, int a_len, double f);
double calculateScalingFactor(int filterPassType, int filterOrder, double fcf1, double fcf2);

double ButterworthFilter(double inputSignal, double* a, double* b, int a_len, int b_len);
double ButterworthFilter2(double inputSignal, double* a, double* b, int a_len, int b_len, int *pos,double* buffer1, double* buffer2);


void IIRDesign(int filterPassType, int filterOrder, int SampleRate, double fcf1, double fcf2, double* a, double* b);
